home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / bogeyman.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  11KB  |  324 lines

  1. /***************************************************************************
  2.  
  3.     Bogey Manor               (c) 1985 Technos Japan
  4.  
  5.     This game runs on Data East designed hardware.
  6.  
  7.     Todo:  Cocktail mode
  8.  
  9.     Emulation by Bryan McPhail, mish@tendril.co.uk and T.Nogi
  10.  
  11. ***************************************************************************/
  12.  
  13. #include "driver.h"
  14. #include "vidhrdw/generic.h"
  15. #include "cpu/m6502/m6502.h"
  16.  
  17. void bogeyman_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  18. void bogeyman_vh_screenrefresh(struct osd_bitmap *bitmap, int full_refresh);
  19. int bogeyman_vh_start(void);
  20. void bogeyman_vh_stop(void);
  21. WRITE_HANDLER( bogeyman_paletteram_w );
  22. WRITE_HANDLER( bogeyman_videoram_w );
  23.  
  24. /******************************************************************************/
  25.  
  26. extern unsigned char *bogeyman_videoram;
  27.  
  28. static READ_HANDLER( bogeyman_videoram_r ) { return bogeyman_videoram[offset]; }
  29.  
  30. /******************************************************************************/
  31.  
  32. /* Sound section is copied from Mysterious Stones driver by Nicola, Mike, Brad */
  33.  
  34. static int psg_latch;
  35.  
  36. static WRITE_HANDLER( bogeyman_8910_latch_w )
  37. {
  38.     psg_latch = data;
  39. }
  40.  
  41. static WRITE_HANDLER( bogeyman_8910_control_w )
  42. {
  43.     static int last;
  44.  
  45.     /* bit 5 goes to 8910 #0 BDIR pin  */
  46.     if ((last & 0x20) == 0x20 && (data & 0x20) == 0x00)
  47.     {
  48.         /* bit 4 goes to the 8910 #0 BC1 pin */
  49.         if (last & 0x10)
  50.             AY8910_control_port_0_w(0,psg_latch);
  51.         else
  52.             AY8910_write_port_0_w(0,psg_latch);
  53.     }
  54.     /* bit 7 goes to 8910 #1 BDIR pin  */
  55.     if ((last & 0x80) == 0x80 && (data & 0x80) == 0x00)
  56.     {
  57.         /* bit 6 goes to the 8910 #1 BC1 pin */
  58.         if (last & 0x40)
  59.             AY8910_control_port_1_w(0,psg_latch);
  60.         else
  61.             AY8910_write_port_1_w(0,psg_latch);
  62.     }
  63.  
  64.     last = data;
  65. }
  66.  
  67. /******************************************************************************/
  68.  
  69. static struct MemoryReadAddress bogeyman_readmem[] =
  70. {
  71.     { 0x0000, 0x17ff, MRA_RAM },
  72.     { 0x1800, 0x1fff, MRA_RAM },
  73.     { 0x2000, 0x21ff, bogeyman_videoram_r },
  74.     { 0x2800, 0x2bff, MRA_RAM },
  75.     { 0x3800, 0x3800, input_port_0_r },    /* Player 1 */
  76.     { 0x3801, 0x3801, input_port_1_r },    /* Player 2 + VBL */
  77.     { 0x3802, 0x3802, input_port_2_r },    /* Dip 1 */
  78.     { 0x3803, 0x3803, input_port_3_r },    /* Dip 2 + Coins */
  79.     { 0x4000, 0xffff, MRA_ROM },
  80.     { -1 }  /* end of table */
  81. };
  82.  
  83. static struct MemoryWriteAddress bogeyman_writemem[] =
  84. {
  85.     { 0x0000, 0x17ff, MWA_RAM },
  86.     { 0x1800, 0x1fff, MWA_RAM, &videoram, &videoram_size },
  87.       { 0x2000, 0x21ff, bogeyman_videoram_w, &bogeyman_videoram },
  88.     { 0x2800, 0x2bff, MWA_RAM, &spriteram, &spriteram_size },
  89.     { 0x3000, 0x300f, bogeyman_paletteram_w, &paletteram },
  90.     { 0x3800, 0x3800, bogeyman_8910_control_w },
  91.     { 0x3801, 0x3801, bogeyman_8910_latch_w },
  92.     { 0x3803, 0x3803, MWA_NOP },    /* ?? */
  93.     { 0x4000, 0xffff, MWA_ROM },
  94.     { -1 }  /* end of table */
  95. };
  96.  
  97. /******************************************************************************/
  98.  
  99. INPUT_PORTS_START( bogeyman )
  100.     PORT_START
  101.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
  102.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
  103.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  104.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  105.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  106.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  107.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
  108.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
  109.  
  110.     PORT_START    /* IN1 */
  111.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  112.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  113.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  114.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   | IPF_8WAY | IPF_COCKTAIL )
  115.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  116.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  117.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  118.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
  119.  
  120.     PORT_START    /* DSW1 */
  121.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
  122.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  123.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
  124.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
  125.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
  126.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) )
  127.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  128.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
  129.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
  130.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_3C ) )
  131.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Demo_Sounds ) )
  132.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  133.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  134.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Cabinet ) )
  135.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  136.     PORT_DIPSETTING(    0x20, DEF_STR( Cocktail ) )
  137.     PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
  138.     PORT_DIPNAME( 0x80, 0x80, "Allow Continue" )
  139.     PORT_DIPSETTING(    0x00, DEF_STR( No ) )
  140.     PORT_DIPSETTING(    0x80, DEF_STR( Yes ) )
  141.  
  142.     PORT_START    /* DSW2 */
  143.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) )
  144.     PORT_DIPSETTING(    0x01, "3" )
  145.     PORT_DIPSETTING(    0x00, "5" )
  146.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Bonus_Life ) )
  147.     PORT_DIPSETTING(    0x02, "50000" )
  148.     PORT_DIPSETTING(    0x00, "none" )
  149.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
  150.     PORT_DIPSETTING(    0x0c, "Easy" )            // Normal
  151.     PORT_DIPSETTING(    0x08, "Medium" )            //   |
  152.     PORT_DIPSETTING(    0x04, "Hard" )            //   |
  153.     PORT_DIPSETTING(    0x00, "Hardest" )            //  HARD
  154.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
  155.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  156.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  157.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
  158.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
  159.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 )
  160. INPUT_PORTS_END
  161.  
  162. /******************************************************************************/
  163.  
  164. static struct GfxLayout charlayout1 =
  165. {
  166.     8,8,    /* 8*8 chars */
  167.     512,
  168.     3,
  169.     { 0x8000*8+4, 0, 4 },
  170.     { 0x2000*8+3, 0x2000*8+2, 0x2000*8+1, 0x2000*8+0, 3, 2, 1, 0, },
  171.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  172.     8*8    /* every char takes 16 consecutive bytes */
  173. };
  174.  
  175. static struct GfxLayout charlayout2 =
  176. {
  177.     8,8,    /* 8*8 chars */
  178.     512,
  179.     3,
  180.     { 0x8000*8, 0+0x1000*8, 4+0x1000*8, 0 },
  181.     { 0x2000*8+3, 0x2000*8+2, 0x2000*8+1, 0x2000*8+0, 3, 2, 1, 0, },
  182.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  183.     8*8    /* every char takes 16 consecutive bytes */
  184. };
  185.  
  186. static struct GfxLayout tiles1a =
  187. {
  188.     16,16,
  189.     0x80,
  190.     3,
  191.     { 0x8000*8+4, 0, 4 },
  192.     { 1024*8*8+3, 1024*8*8+2, 1024*8*8+1, 1024*8*8+0, 3,2,1,0,
  193.         1024*8*8+3+64, 1024*8*8+2+64, 1024*8*8+1+64, 1024*8*8+0+64, 3+64,2+64,1+64,0+64 },
  194.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  195.         0*8+16*8, 1*8+16*8, 2*8+16*8, 3*8+16*8, 4*8+16*8, 5*8+16*8, 6*8+16*8, 7*8+16*8 },
  196.     32*8    /* every tile takes 32 consecutive bytes */
  197. };
  198.  
  199. static struct GfxLayout tiles1b =
  200. {
  201.     16,16,
  202.     0x80,
  203.     3,
  204.     { 0x8000*8+0, 0+0x1000*8+0, 4+0x1000*8 },
  205.     { 1024*8*8+3, 1024*8*8+2, 1024*8*8+1, 1024*8*8+0, 3,2,1,0,
  206.         1024*8*8+3+64, 1024*8*8+2+64, 1024*8*8+1+64, 1024*8*8+0+64, 3+64,2+64,1+64,0+64 },
  207.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  208.         0*8+16*8, 1*8+16*8, 2*8+16*8, 3*8+16*8, 4*8+16*8, 5*8+16*8, 6*8+16*8, 7*8+16*8 },
  209.     32*8    /* every tile takes 32 consecutive bytes */
  210. };
  211.  
  212. static struct GfxLayout sprites =
  213. {
  214.     16,16,
  215.     0x200,
  216.     3,
  217.      { 0x8000*8, 0x4000*8, 0 },
  218.     { 16*8, 1+(16*8), 2+(16*8), 3+(16*8), 4+(16*8), 5+(16*8), 6+(16*8), 7+(16*8),
  219.         0,1,2,3,4,5,6,7 },
  220.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 ,8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8},
  221.     16*16
  222. };
  223.  
  224. static struct GfxDecodeInfo gfxdecodeinfo[] =
  225. {
  226.     { REGION_GFX1, 0x00000, &charlayout1,     16, 32 },
  227.     { REGION_GFX1, 0x00000, &charlayout2,     16, 32 },
  228.     { REGION_GFX2, 0x00000, &sprites,          0,  2 },
  229.     { REGION_GFX3, 0x00000, &tiles1a,     16+128,  8 },
  230.     { REGION_GFX3, 0x00000, &tiles1b,     16+128,  8 },
  231.     { REGION_GFX3, 0x04000, &tiles1a,     16+128,  8 },
  232.     { REGION_GFX3, 0x04000, &tiles1b,     16+128,  8 },
  233.     /* colors 16+192 to 16+255 are currently unassigned */
  234.     { -1 } /* end of array */
  235. };
  236.  
  237. /******************************************************************************/
  238.  
  239. static struct AY8910interface ay8910_interface =
  240. {
  241.     2,      /* 2 chips */
  242.     1500000,        /* 1.5 MHz ? */
  243.     { 30, 30 },
  244.     { 0 },
  245.     { 0 },
  246.     { 0 },
  247.     { 0 }
  248. };
  249.  
  250. /******************************************************************************/
  251.  
  252. static struct MachineDriver machine_driver_bogeyman =
  253. {
  254.     /* basic machine hardware */
  255.     {
  256.          {
  257.             CPU_M6502,
  258.             2000000, /* 12 MHz clock on board */
  259.             bogeyman_readmem,bogeyman_writemem,0,0,
  260.             interrupt,16 /* Controls sound */
  261.         }
  262.     },
  263.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  264.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  265.     0,    /* init machine */
  266.  
  267.     /* video hardware */
  268.     32*8, 32*8, { 0*8, 32*8-1, 1*8, 31*8-1 },
  269.  
  270.     gfxdecodeinfo,
  271.     16+256, 16+256,
  272.     bogeyman_vh_convert_color_prom,
  273.  
  274.     VIDEO_TYPE_RASTER | VIDEO_UPDATE_BEFORE_VBLANK | VIDEO_MODIFIES_PALETTE,
  275.     0,
  276.     bogeyman_vh_start,
  277.     bogeyman_vh_stop,
  278.     bogeyman_vh_screenrefresh,
  279.  
  280.     /* sound hardware */
  281.     0,0,0,0,
  282.     {
  283.         {
  284.             SOUND_AY8910,
  285.             &ay8910_interface
  286.         }
  287.     }
  288. };
  289.  
  290. /******************************************************************************/
  291.  
  292. ROM_START( bogeyman )
  293.     ROM_REGION( 0x58000, REGION_CPU1 )
  294.      ROM_LOAD( "j20.c14",  0x04000, 0x04000, 0xea90d637 )
  295.     ROM_LOAD( "j10.c15",  0x08000, 0x04000, 0x0a8f218d )
  296.     ROM_LOAD( "j00.c17",  0x0c000, 0x04000, 0x5d486de9 )
  297.  
  298.     ROM_REGION( 0x10000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  299.     ROM_LOAD( "j70.h15",  0x00000, 0x04000, 0xfdc787bf )    /* Characters */
  300.     ROM_LOAD( "j60.c17",  0x08000, 0x01000, 0xcc03ceb2 )
  301.     ROM_CONTINUE(         0x0a000, 0x01000 )
  302.  
  303.     ROM_REGION( 0x0c000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  304.     ROM_LOAD( "j30.c9",   0x00000, 0x04000, 0x41af81c0 )    /* Sprites */
  305.     ROM_LOAD( "j40.c7",   0x04000, 0x04000, 0x8b438421 )
  306.     ROM_LOAD( "j50.c5",   0x08000, 0x04000, 0xb507157f )
  307.  
  308.     ROM_REGION( 0x10000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  309.     ROM_LOAD( "j90.h12",  0x00000, 0x04000, 0x46b2d4d0 )    /* Tiles */
  310.     ROM_LOAD( "j80.h13",  0x04000, 0x04000, 0x77ebd0a4 )
  311.     ROM_LOAD( "ja0.h10",  0x08000, 0x01000, 0xf2aa05ed )
  312.     ROM_CONTINUE(         0x0a000, 0x01000 )
  313.     ROM_CONTINUE(         0x0c000, 0x01000 )
  314.     ROM_CONTINUE(         0x0e000, 0x01000 )
  315.  
  316.     ROM_REGION( 0x0200, REGION_PROMS )
  317.     ROM_LOAD( "82s129.5k",  0x0000, 0x0100, 0x4a7c5367 )    /* Colour prom 1 */
  318.     ROM_LOAD( "82s129.6k",  0x0100, 0x0100, 0xb6127713 )    /* Colour prom 2 */
  319. ROM_END
  320.  
  321. /******************************************************************************/
  322.  
  323. GAMEX( 1985?, bogeyman, 0, bogeyman, bogeyman, 0, ROT0, "Technos Japan", "Bogey Manor", GAME_IMPERFECT_COLORS | GAME_NO_COCKTAIL )
  324.